﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using DAL.Dao;
using DAL;

namespace BLL
{
    public class DeliverymanImpl : IDisposable
    {
        private static DeliverymanDaoimpl _dao;
        public int ExistNum { get { return _dao.ExistNum; } private set { } }
        public DeliverymanImpl()
        {
            if(_dao==null)
            _dao = new DeliverymanDaoimpl();
        }
        public IList<Deliveryman> GetDeliverymanInfo(int id)
        {
            var rs = _dao.GetDeliverymanInfo(id);
                
            return rs;
        }


        public Deliveryman GetItemByID(int id)
        {
            return _dao.GetItemByID(id);
        }
        public IList<Deliveryman> GetList()
        {
            return _dao.GetList();
        }

        public (int,IList<Deliveryman>) GetList(int rows,int page)
        {
            return _dao.GetList(rows, page);
        }

        public IList<Deliveryman> GetDeliverymanInfo(string username)
        {
            var rs = _dao.GetDeliverymanInfo(username);

            return rs;
        }

        public Deliveryman Login(string username,string userpass)
        {
            return _dao.Login(username,userpass);
        }
        public bool Update(int id,Deliveryman deliveryman)
        {
            return _dao.Update(id,deliveryman);
        }

        public bool Delete(int id)
        {
            return _dao.Delete(id);
        }
        public Deliveryman Find(int id)
        {
            return _dao.Find(id);
        }

        public bool Add(Deliveryman deliveryman)
        {
            return _dao.Add(deliveryman);
        }
        public void Dispose()
        {
            _dao.Dispose(); 
        }
    }
}
